<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="css/note-ui.css"/>
<script type="text/javascript;version=1.8" src="tiny_mce.js"></script>
<script type="text/javascript;version=1.8">
	tinyMCE.init({
		// General options
		body_id : "zotero-tinymce-note",
		mode : "none",
		theme : "advanced",
		content_css : "css/note-content.css",
		button_tile_map : true,
		language : "en", // TODO: localize
		entities : "160,nbsp",
		gecko_spellcheck : true,
		convert_urls : false,
		
		handle_event_callback : function (event) {
			zoteroHandleEvent(event);
		},
		
		onchange_callback : function () {
			zoteroHandleEvent({ type: 'change' });
		},
		
		setup : function (ed) {
			// Set text direction
			var dir = window.location.href.match(/dir=(ltr|rtl)/)[1];
			ed.settings.directionality = dir;
			// Include button for opposite direction, to function as a toggle
			ed.settings.theme_advanced_buttons1 = ed.settings.theme_advanced_buttons1.replace(
				"%DIR%",
				"," + dir.split("").reverse().join("")
			);
			
			ed.onInit.add(function (ed) {
				zoteroInit(ed);
			});
			
			["Cut", "Copy", "Paste"].forEach(function (command) {
				let cmd = command;
				ed.addCommand(command, function (ui, value) {
					zoteroExecCommand(ed.getDoc(), cmd, ui, value);
				});
			});
		},
		
		fix_list_elements : true,
		fix_table_elements : true,
		plugins : "paste,contextmenu,linksmenu,directionality,autolink",
		
		// Theme options
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,sub,sup,|,forecolor,backcolor,|,blockquote,|,link,|,%DIR%",
		theme_advanced_buttons2 : "formatselect,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,outdent,indent,|,removeformat,code",
		theme_advanced_buttons3 : "",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "none",
		
		// More restrictive version of default set, with JS/etc. removed
		valid_elements : "@[id|class|style|title|dir<ltr?rtl|lang|xml::lang],"
			+ "a[rel|rev|charset|hreflang|tabindex|accesskey|type|"
			+ "name|href|target|title|class],strong/b,em/i,strike,u,"
			+ "#p,-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|"
			+ "src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,"
			+ "-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|"
			+ "height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|"
			+ "height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,"
			+ "#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor"
			+ "|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,"
			+ "-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face"
			+ "|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],"
			+ "object[classid|width|height|codebase|type],param[name|value|_value],"
			+ "map[name],area[shape|coords|href|alt|target],bdo,"
			+ "button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|"
			+ "valign|width],dfn,fieldset,"
			+ "kbd,label[for],legend,optgroup[label|disabled],option[disabled|label|selected|value],"
			+ "q[cite],samp,select[disabled|multiple|name|size],small,"
			+ "textarea[cols|rows|disabled|name|readonly],tt,var,big"
	});
	tinyMCE.execCommand("mceAddControl", true, "tinymce");
</script>
<style>
table.mceLayout {
	border-left: 0 !important;
	border-right: 0 !important;
	border-top: 0 !important;
}
</style>
</head>
<body>
<div id="tinymce"></div>
</body>
</html>
